import 'dart:convert';

import 'package:riverpod_t/generated/json/base/json_field.dart';
import 'package:riverpod_t/generated/json/info_model.g.dart';

@JsonSerializable()
class InfoListModel {
  List<InfoModel> works = [];
  String newsContent = '';
  String cover = '';
  int shareCount = 0;
  String mcnIcon = '';
  String editorName = '';
  int mcnTemplateId = 0;
  int followStatus = 0;
  int entityType = 0;

  String nickName = '';
  bool isThumbs = false;
  int commentCount = 0;
  String pageViewStr = '';
  String shareCountStr = '';
  int subType = 0;

  // List newsPics = [];

  int status = 0;

  String mcnRealName = '';
  String creationTime = '';
  bool isLike = false;
  String userAvatar = '';

  String mcnPageView = '';
  String description = '';
  String commentCountStr = '';
  String title = '';
  String mcnFansCount = '';

  String brandLogo = '';
  int channelId = 0;
  String thumbsCounts = '';
  int original = 0;
  String uVContent = '';
  int entityId = 0;

  String userName = '';

  String userId = '';
  String url = '';
  int pageView = 0;
  String createTime = '';
  int mcnId = 0;
  int categoryId = 0;

  InfoListModel();

  InfoListModel copyWith({
    List<InfoModel>? works,
    String? newsContent,
    String? cover,
    int? shareCount,
    String? mcnIcon,
    String? editorName,
    int? mcnTemplateId,
    int? followStatus,
    int? entityType,
    String? nickName,
    bool? isThumbs,
    int? commentCount,
    String? pageViewStr,
    String? shareCountStr,
    int? subType,
    int? status,
    String? mcnRealName,
    String? creationTime,
    bool? isLike,
    String? userAvatar,
    String? mcnPageView,
    String? description,
    String? commentCountStr,
    String? title,
    String? mcnFansCount,
    String? brandLogo,
    int? channelId,
    String? thumbsCounts,
    int? original,
    String? uVContent,
    int? entityId,
    String? userName,
    String? userId,
    String? url,
    int? pageView,
    String? createTime,
    int? mcnId,
    int? categoryId,
  }) {
    return InfoListModel()
      ..works = works ?? this.works
      ..newsContent = newsContent ?? this.newsContent
      ..cover = cover ?? this.cover
      ..shareCount = shareCount ?? this.shareCount
      ..mcnIcon = mcnIcon ?? this.mcnIcon
      ..editorName = editorName ?? this.editorName
      ..mcnTemplateId = mcnTemplateId ?? this.mcnTemplateId
      ..followStatus = followStatus ?? this.followStatus
      ..entityType = entityType ?? this.entityType
      ..nickName = nickName ?? this.nickName
      ..isThumbs = isThumbs ?? this.isThumbs
      ..commentCount = commentCount ?? this.commentCount
      ..pageViewStr = pageViewStr ?? this.pageViewStr
      ..shareCountStr = shareCountStr ?? this.shareCountStr
      ..subType = subType ?? this.subType
      ..status = status ?? this.status
      ..mcnRealName = mcnRealName ?? this.mcnRealName
      ..creationTime = creationTime ?? this.creationTime
      ..isLike = isLike ?? this.isLike
      ..userAvatar = userAvatar ?? this.userAvatar
      ..mcnPageView = mcnPageView ?? this.mcnPageView
      ..description = description ?? this.description
      ..commentCountStr = commentCountStr ?? this.commentCountStr
      ..title = title ?? this.title
      ..mcnFansCount = mcnFansCount ?? this.mcnFansCount
      ..brandLogo = brandLogo ?? this.brandLogo
      ..channelId = channelId ?? this.channelId
      ..thumbsCounts = thumbsCounts ?? this.thumbsCounts
      ..original = original ?? this.original
      ..uVContent = uVContent ?? this.uVContent
      ..entityId = entityId ?? this.entityId
      ..userName = userName ?? this.userName
      ..userId = userId ?? this.userId
      ..url = url ?? this.url
      ..pageView = pageView ?? this.pageView
      ..createTime = createTime ?? this.createTime
      ..mcnId = mcnId ?? this.mcnId
      ..categoryId = categoryId ?? this.categoryId;
  }

  factory InfoListModel.fromJson(Map<String, dynamic> json) => $InfoListModelFromJson(json);
  Map<String, dynamic> toJson() => $InfoListModelToJson(this);
  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class InfoModel {
  String mcnRealName = '';
  String uVContentStr = '';
  int adFlag = 0;
  String description = '';
  String title = '';
  int checkStatus = 0;
  String mcnIcon = '';
  int adFlagShow = 0;
  int adsType = 0;
  int worksType = 0;
  int id = 0;
  int uVContent = 0;
  String avatarUrl = '';
  int entityType = 0;
  String nickName = '';
  int userId = 0;
  String url = '';
  String createTime = '';
  String createTimeStr = '';
  String videoCover = '';
  List<String> newsPics = [];
  int isThumbs = 0;
  bool isLike = false;
  InfoModel();
  factory InfoModel.fromJson(Map<String, dynamic> json) => $InfoModelFromJson(json);
  Map<String, dynamic> toJson() => $InfoModelToJson(this);
  @override
  String toString() {
    return jsonEncode(this);
  }
}
